// MidiProgram.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include"Midi.h"
#include"MidiMessage.h"
#include<stdlib.h>
enum Voice
{
	L1 = C3, L2 = D3, L3 = E3, L4 = F3, L5 = G3, L6 = A3, L7 = B3,
	M1 = C4, M2 = D4, M3 = E4, M4 = F4, M5 = G4, M6 = A4, M7 = B4,
	H1 = C5, H2 = D5, H3 = E5, H4 = F5, H5 = G5, H6 = A5, H7 = B5,
	LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,
	_ = 0XFF
};


int main()
{
	Midi midi;
	srand(time(0));
	int song1[] = {
		M1,M2,M3,M4,M5,M6,M7
	};//乐谱1
	int song2[] = {
		H7,H6,H5,H4,H3,H2,H1
	};//乐谱2
	midi.tracks[0].program_change(0x8);//设置音轨0的乐器为0x8号乐器
	midi.tracks[1].program_change(0x5);//设置音轨1的乐器为0x8号乐器
	for (int i = 0; i < 7; i++) {
		midi.tracks[0].note(song1[i], 300);//音轨0导入乐谱1的信息,时间为300
		midi.tracks[1].note(song2[i], 300);//音轨1导入乐谱1的信息,时间为300
	}
	midi.play();//播放midi
	midi.write_file("E:/User/Desktop/TEST.MID");
	//可以保存文件到本地
	return 0;
}


